
package com.htd.htdapmservice.xxljob;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.htd.htdapmservice.request.SearchAlarmInto;
import com.htd.htdapmservice.service.intf.OneAlertService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;


@JobHandler(value="syncAlarmStatusJobHandler")
@Component
public class SyncAlarmStatusJobHandler extends IJobHandler {
    private static final Logger logger = LoggerFactory.getLogger(SyncAlarmStatusJobHandler.class);

    @Autowired
    private OneAlertService oneAlertService;
    
	@Override
	public ReturnT<String> execute(String param) throws Exception {

        logger.info("syncAlarmStatusJobHandler Entrance, param : {}", new Object[]{ JSONObject.toJSONString(param)});

        try{
			SearchAlarmInto searchAlarmInto = new SearchAlarmInto();
			searchAlarmInto.setStatus("ACK,CLOSED");
			oneAlertService.searchAlarm(searchAlarmInto);
            
        } catch (Exception e){
            logger.error("syncAlarmStatusJobHandler error:", e);
            return FAIL;
        }
        
		return SUCCESS;
	}



}
